package org.jeecg.modules.monitoring.j_monitoring.vo;

import io.swagger.annotations.ApiModelProperty;
import org.jeecg.modules.monitoring.j_monitoring.entity.MDocumentManagement;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 文档树节点类
 */
public class DocTreeNode implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private String key;

    /**
     * 主键ID
     */
    private String id;

    /**
     * 主键ID
     */
    private String pid;


    private String value;

    private String title;
    private boolean isLeaf;

    List<DocTreeNode> children = new ArrayList<>();

    public DocTreeNode(){

    }

    public DocTreeNode(MDocumentManagement treeModel){
        this.key = treeModel.getId();
        this.id = treeModel.getId();
        this.pid = treeModel.getParentId();
        this.title = treeModel.getTitle();
        this.value = treeModel.getContent();
    }

    /**
     * 将SysDepartTreeModel的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public DocTreeNode convert(MDocumentManagement treeModel) {
        this.key = treeModel.getId();
        this.id = treeModel.getId();
        this.pid = treeModel.getParentId();
        this.title = treeModel.getTitle();
        this.value = treeModel.getContent();

        return this;
    }


    public List<DocTreeNode> getChildren() {
        return children;
    }

    public void setChildren(List<DocTreeNode> children) {
        this.children = children;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getKey() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPid() {
        return pid;
    }

    public void setPid(String pid) {
        this.pid = pid;
    }

    public String getValue() {
        return id;
    }

    public boolean isLeaf() {
        return isLeaf;
    }

    public void setLeaf(boolean leaf) {
        isLeaf = leaf;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
